const fs = require('fs');

title=[
    'button',
    'col',
    'input',
    'row',
    'switch'
]
for (const t of title){
    fs.truncate(`${t}.tsx`, 0, (err) => {
        if (err) throw err;

        const capital = 'El' + t.charAt(0).toUpperCase() + t.slice(1);
        fs.writeFile(`${t}.tsx`, `
import { ${capital} } from "element-plus";

export default {
  name: "${t}",
  render: (props, styles) => (
    <div style={styles}>
      <${capital} {...props}>${t}</${capital}>
    </div>
  ),
};

        `, (err) => {
            if (err) throw err;
            console.log(`${t}.tsx -----!`);
        });
    });
}
